refactor, not working