Relocated working functions to unit test suite