Fixing bug with multiple 'layout' statements

The second statement was overriding the first, so even though they didn't conflict the first wasn't working. Moved layout decisions to a private method.