allow user to update his own groups in profile page
code cleanup and error handling