js cleanup, beautified code