refactored the sketch 2D source codes