#2076: Refactored layout engine to be more generic. Svn-copied folders from trunk and readded layout files.