correctly apply format and some other small issues