Fixes for most of the unit tests & add new unit tests for changes