cleanuped mdoe check code in controllers