Add callback in addDatabase function and timeout management