Reorganization to make unit testing easier