refactor and add regId to table user