Convert UI to Module

This fixes #312 in the most elegant way I could find...