ninja layout refactoring