refactor module handler.