refactor + add test