Refactored to add user roles functionality.