Added comments and some JUnit tests