replaced hardcoded 'userprincipalname' with proper $email and fixed some formatting