file doesnt need to be invoked via flag
added some more error handling