It works even better now. Added parameters all over the place, made sure the corners won't get overwritten, and other things that I've forgotten.