refixed john's non-thread-safe code (with TODO to make it faster later), also fixed ezexamples implementation