Project 4: Some much needed refactoring...