added ungroup to wrap up reduce phase
use print to print
fixes #3