refactored with layouts