Added example using state api