Updated with stateful behavior