Added some timeouts in javascript with error messages