This looks like something that can probably already be done with diagram functions.