abstracted out file option handling
updated lib