Started Javascript code improvement/refactoring.