Documentation and code structure improvements