Documentation and some reorganization of public interface