No need to set the cursor within the loop you can remove it.
Also, no need to do "on_select_tag()"