Optimizing code of indexing function. Fix error in form_keydown event then select DP