reformat code; fix reference errors in commands.js