Cleaned up ball control code