restructuring and few javadocs