Divided service into functions