Sped up moving cursor to closest position

Now uses pre-calculated values instead of calculating it.