some cleaning up
added support for username and email fields