Leave the layers of the system that you cannot understand alone, and replace the others. For example, database wrapping would leave the old database intact and replace the processing code; code wrapping would leave the old decision-making algorithms, but replace the database engine; application wrapping would preserve the entire application, but would replace its environment - e.g., emulate an operator's input with a programming interface.