Refactoring: made helper functions private