separate ajax calls into factories