Rework template wrapping. Now wraps most of arma, but still incomplete and needs more tests