minor refactorings
refactors unit tests and adds reset()
updates uglified js