revert to using main() function and attempt to use yield