Finished main code

I have some debugging to work out and need to make all of the funtion
that need to return, but I am close.