Document formatting improvements