Added timeout option and other features