some refactorings and adjustments for op_code