added resample functions also clean up the code a little bit, please make sure that you read the workflowlog file before getting started