Support custom wait and stop functions.