JShint fixes and speed improvements