Outsourced functions to module

Outsources functions to a simple python module to avoid writing the same functions over and over again. Some scripts need to be rewritten to use the module instead of defining their own version of the functions.