add modules and refactor code