Made variables private in ball.js and tidied up some code.