added service started detection logic