implemented ex5 and wrote makefile for day1, cleaned up code