Added operation encoding logic.