refactor ball class