implemented layout layoutAttributesForElementsInRect + tests
minor code cleanup in layout section