added new sql functions, and restructured the files