Timeout fixed

* Also some cosmetic improvements