Add support for protect.py, reorder entities

Change-Id: I9e1e45afd622604c2dff2f24c2a0c2ac83c449a5