made some variables extern and added getActualPositionScaled function