Program works, but takes too long to pass sphere