cleaned up states code