Updated to correct clearing of encoder data