Feature/cursor rewrite

Code review plz.

@kyleterry @colby @Hamcha