make selection of quotes slightly less memory consuming
replace create_function with anonymous functions to avoid severe memory leaking