Restore timeout feature

PR opened for discussion. Work in progress, do not merge atm.