Some generics tweaks and adding javadoc