formatting and clean up before UA conversion