Reorganize code structure in slothy.model