Sublist function and refactoring. Added generated javadoc