Implement edge case and test for reduce functionality