Refactored/fixed some unit tests