created register function for user