fixed some database syntax and removed depricated tables