Function

Step 4. Added Error function.