Cleaned up reduce and global namespace