Fixed selection bugs, refactored grid selection