before modify selectrecord
rewrite of the API for not raw queries
code cleanup