Devided queries AND devided into if/else js format