Reorganize program structure