Refactor module and layout