lots of bugfixes. xr,yr were wrong. caught some corner cases
updates
updates