initial calc-error-profile code working
fixed up error profile calculation