bulk of formatting done