Make index.js more legit - command line args, argument validation, main function, tests