refactored to use layouts