refactor in core.controller