Resilience ported and identical to www2013