Changed way of position counting
small fixes