added documentation, minor fixes