Change state and add sort flag

This removes the close flag in favor of a generic state flag that takes a string for the state you want to display.