improved file reading

also fixed the z for .getVertexAtXY()