#23 Finish refactoring (for now)