Added waiting time check code (hopefully not breaking anything)