Selectable layout

Allow users to select the layout between top-down (default) and bottom-up.
Fixes #171