refactor + test