Refactor attribute handling to add support for emailAddress (fixes #5)