use tempfile to create and handle temporary files
get rid of "dont remove" option
just small stuff
added non standalone support