Added bar chart, some code cleanup