Fixed Program Erros

The Program now works, as it should. However it is poorly commented and
very messy. Please wait until I fix that.