Refactoring for programming assignment 3
Written assignment 4