Refactored code. Moved layout service into layout module.