Added a script for running jasm
Some bug fixes.
Minor refactoring.