Made some changes to the functions.
Cleaned up all of the code and added variabe to meet the requirements.