PYKE-549 - some refactoring and layout code