moved off most of the code into the functions file

most of the editing will now be done in functions.ps1