refactor: separate logic from mutation
refactor