Refactoring to use generic map instead of Response