rename main to main.js
catch if error on stdin and formatting