Completed problem, still requires refactoring