Various changes made in order  to make testing with mocks work.