Adapt the code