added memory to be used by the parser
some fixes in Stream prototype
sped up removeSelection
improved JavaScript parser