placed line-drawing in function