tests green, need to refactor