Fixed memory leaks and changed representation of point.