Added support for non-horizontal layouts