refactor for nuts