Add timeout option
Fix code formatting