test coverage-related changes, init code, bug fixes

Stony, this pull includes the following:
(1) Code rewrite with a view to obtaining test coverage. For this I had to make the code somewhat more modular. This code now has sufficient coverage to either deploy or put in a package.
(2) Init code to automatically create two Custom Settings records & thereby leave less setup work for a person installing the managed package version for the first time.
(3) Fix of the CloseDate problem. Upserted Opportunity records should now have the proper Close date.