Makefile and some random utils
refactor shared stuff
consistency and minor cleanups