Clean-up

Did some refactoring of the code.
Error fix

I am still getting used to using Git.