Minor comment update.
Added explicit type check in wait method.'
Refactored and added more tests.