updated code now with 80% more success!