start refactoring of Xhr management