Makefile improvements and code cleanup.