Significant refactoring of functions, added python3

Refactored functions, code to be much more legible. Pushed some things
out to individual install files and also altered some of them.