Rewrite code for service with parameters