added support for multiple layouts