Using getAttributes() instead of toArray()