fixed a few runtime errors. I think it works now; COMPILES:TESTED