Added bunch of javadocs and some new test cases.