refactored to new position calculation - fixed errors
refactored to new position calculation - fixed errors