Implemented line drawing function