move control layout stuff to a separate file