Refactor module definition