First pass at refactoring