Made timeout an explicit parameter (default = 5 sec)