Seems to work. Lot of debugging garbage still in there.