cleaned up geometry class and added more extensive comments and javadocs