Fix layout order

See #22.

This solution is based on @mconventi's solution, I only cleaned it up a little.