Changes based on review comments and added Javadoc comments and some extra features and tests