updated sql tabels and framework