Intermediate version with documented comments. Before change from the module pattern to factory pattern.