moved observer functionality to main