Refactor attributestore initialization into multiple functions