Smarter makefile and some additional functions to simplity things a bit.