further documentation, new environment setting, refactoring