Adding logic to find correct service command