refactor method to use map rather than inject