BITMAG-1042
BITMAG-1022: Fixed broken tests, and added tests for the functionality.