Make cmd_storage static

Move the sort_commands function into a separate function in the commands.c
file to simplify main.c