refactor code to use multiple module