Added a utils object with some useful common code

Working on consolidating things and refactoring old spaghetti code.
Work on cleaning the code and fixing inefficiencies.
Merge pull request #523 from Jedwondle/v1.3

Current utils and code clean up.