Fixing a couple of SQL issues, also found a rather large bug :"