updated docs and refactored code