Fix Makefile issues and move config parser functions into new files