added parser.js
solved some serious bugs
prettyfied the code, and now lot lot work to do to make it all work