added result builder function and capture function