modified line drawing code