Improved our layout managing code