add module pattern, apply code style