Refactor position update. Fix bugs in position update.

Metrics/LineLength: Line is too long. [81/80]