refactor settings, change domentation and add docstrings for key functions