before layout stuff