This whole mocking setup. Not easy to write good test for this stuff