modified to use user table