Moved layout functions to its own file