Cleaned up get_cmd

Also shortened some long lines