Added check for having self as waiton and added a toplevel test