Changed timeout timer from NSTimer to GCD timer to avoid retain cycle.
Replacing rand() for arc4random() to suppress related clang analyser's warnings