Added infrastructure for discourses

Also new tests