Possibly final implementation before clean up and javadocs