restructuring modules to make dependencies clearer