refactor of the service layer and relative testing unit