improved FB network code