Added static variable to hold previous values