unnecessary extra import
consistent usage of timeout context manager
minor refactoring
better error message for timeout