add documentation, structure, minor fixes