Added clear method to reset rising and falling flags