ball code from saver, needs refactoring