Fixed bar updating by adding a bar amount class. Minor refactorings.