Updated sql and all