Fixed up some logic errors that junked up formatting