Push/Pop

Refactoring of pushing and popping (to account for source order); JS refactor, cleanup, bugfixes.