Still dead(ish)

SQL fixes and additions