partial implementation of restructuring to make testing easier