clean up back-end code, add edit user email/nickname function