Cleanup debugging code modifications + improve tests (OMS-531)