Moved more methods out of main.