Refactor: Helper functions in proper place