Some refactoring: Module pattern added