Revert "Revert "Changing timeout functions""

This reverts commit fb7a754e5f89dad9face525d46582dc1c75b502c.