Refactoring to use modules instead of classes. Updating tests.