Updated version, with simpler definitions of modules