added logic to draw/select grid fields