restructured new formatting code