changed sql structur