Added error sampler and tested it