refactored
refactored to use vars already within scope and reuse computed sin and cos of target point