ball function seems to work