Finished up to exercise 4. Refactoring next to better understand whats going on.