Refactor reducer functions for readability