Move the helper functions to the top of the main function, and the main function commands (bind command) to the bottom.