adding drawBar function