rewriting service code