Refactored to use layouts.