added midwrite and updated Makefile