Further refactoring into modules