Continued rewriting/refactoring