drawing function implemented