Error Checking and Assigning default value

Hello! This is my first pull request, so please bear with me. It's such a wonderful tool and I've made many changes to it. I am trying to organize the changes I made and hope this will help improve upon it.

The initial changes I am submitting are the following:
1) Give default value of "1" to $count variable, if it doesn't have a value.
2) Added function check_prereqs(), which will do some basic error and sanity checking before running.
3) In the tidy up sections, did tests to check if files existed before rm'ing them. Otherwise, the script will display error messages with could confuse users.