@herryliq you could start by looking into this feature that already exists. It could simplify your work a lot: