Better impl of the protect/preprocess