changes in functions and new functions to work with SQL