Php 1093 refactor cursor logic

Good point...