some changes to draw() and added test for draw()