Refactor private functions into classes