most of mikes fixes implemented
mikes fixes all in