Implemented snap to grid