get rid of unused file
check for another malloc failure
update error handling
add missing include