Refactor Controller module and fixed hanging issue.