refactor, define service and local