Made updatePosition() better