improved updatePosition()