OrganiseFormat might do all this for you