Add optional service support

I made a new pull request against master. This one should be merged after #4.