Refactored into proper module pattern, added temporary working demo code.