Add Makefile and clean up code.