added memory allocation checks
cleaned up host file