refactor is functional, still requires testing and more features