split layout functions into own file

- preparation for layouts as loadable modules