set functions on top of script, set outputfile prefix as fap