issue 138 implemented waitFor method