Part 1 complete

Added error checking
Added test cases in Makefile