Heavy cursor handling refactoring

This elegant approach of cursor handling was sponsored by @Osse.

Thanks!