I'm not sure these print statements are really useful. Perhaps just printing ret would be simpler.