Fixes #17 -- this is probably really ugly.