fix wrap and general cleanup