Working version with service (to be refactored)