restructured code; added Makefile