Adding makefiles, some code cleanup