functionality for ball