JC-1333 fixed. Additional tests created. Code review concerned