MainTask.c refactor

variables moved to controllers.c