Miscellaneous code cleanup, including Makefile and test file
More test case