attempt to refactor