cleaned up ref docs
Fixed wait(), more tests, fixed example