first pass at refactor