Code cleanups - separating private and public functions