improved generate.py, updated makefile