implementing layout to remove duplication