more generic API for window functions