removed unnecessary comments and added snapping for lines