added function to compare states