Reorganize the code structure