refactor and change representation of types (startPos, endPos)