new functionality - sql working