Adding design-time support

I'm afraid to refactor this code too much with a lot of things here being untested/untestable in the current state. If we want to do much more here I can help, but it's going to take some effort.