Fix #36 anhanced backend functionalities

`$query2` is not good name for variable. Please use meaningful variable names instead from next PR.