added support for built-in reduce functions; more unit tests