add ball logic