Separated out layout code, improved layout.
Minor syntax fix.