[Refactoring] Moved methods out of the main class.