p4 optmizations