Fixed broken makefiles
Minor changes to the interface and slightly better error checking.