fixed table creation and user changing algorithm