Added SQL/lot of functions