refactor code to use vecs to represent points