MDLSITE-3650 added unit tests and reshuffled to make unit testing possible