Extend command to support .js files, better error handling