Various improvements

Various improvements to syntax, readability and code reduction as well as a directory fix for Makefile.