incoorporated Joey's updated code today, but it only seems to fix the return 0 problem partially