Moved preprocessing functions into single python script. Some minor edits to those functions (notes in comments).