Making changes to the code based on FichteFoll's suggestions.  Much cleaner now.