Improving test coverage. Also adding some javadocs