correctly calculating r_sy now, restructured files