sphere function tweaked