encapsolate the ball function