Separated functions & main in JScript

Also made filenames look nicer