Factored out commands and their queries to commands.js