rev 6

Cleaned up the code. Made sure the code appears as professional as I am
able to. Seperated functions and did final check to verify code was
working.