move bar listener into the constructor