cleanup of checkCommand function and added a preamble