minor changes on position calculation