generic draw function