factored out bar related code into plugins