Re-wrote preflight/postflight scripts in python, added some features, and updated Makefile task