refactor + tests + 100% coverage