Rewrite Module class and associated demo to use refactored code.