Updated script parsing
Major refacotring