Reorganize code base