Add a dictionary variation of the layout and constrain functions Take 2

Same as #44, except it targets master and the functions now use generic keys.