added new unit tests and made various minor modifications