Modules work

For @moritzdannhauer to work on #660.