Added JavaDoc annotations and reorganised core classes.