Finished Exercise 27 and some previous bugs