Added service, fixed timebased problems and state change problems