Flattened structure and added javadoc