reformatted ball collision code and tried to make it more readable