Move initializing logic to a controller module.
Reorganize define statements.