Reorganize code in several modules