Add Makefile. Other minor changes and reorganisation.