move messages to debug logging and trim command before checking for :exit