Made headers disappear if there is no one listed below them.

Cleaned up some whitespace in the code as well.