collect is standalone, needs main function