added edit user feature; did a major code cleaning (DRY)