flag 2 -> -1
modified not to replace user table
modified to check queue