Added snap to grid behavior