updated drawLine method