Clean up the way command handling is done so that command handlers are their own function