refactoring several javascript convention issues