Add tests and fix timeout