Complete nextPoint function