Added waiting time option, this still needs some testing.