add timeout option

Ready for review