Refactor and first getting an array of tags