simplify & clean up code, add xz compression