Move bars function to a separate file