Implemented service functions (with tests) and service events (OnInit, OnStop, OnClose)