Changes to allow unit testing