refactored code to readability, testing, docs, maintainability

- [ ] - add test case with and without options