Initial prototype for structure learning

Pay no attention to any unsightly hacks that may or may not be present.