Split observer to seperate file. Added a couple of test. Added comments