Added events support between node and firmatra. Refactored code