implement the frontia push service and refactor the code