Initial implementation of #41
Probably going to break horribly :P