Added timer and handler of timeout