Some problems with the service lifecycle fixed. Added some logging