Refactoring: Move template instruction processing codes to method of new class
Throw `InvalidInstruction` exception when invalid instruction is processed