code factorization, fix minor bug, add dependencies to pushservice