Adding error messages for incorrect cpi input.
Fixing function definition.