checkpointing before refactoring
incrementally working
Cleaner javascript. Code complete