refactored ball racket collision code