Refactored layout service