Slightly clean up the main function.