Imported from https://github.com/drewlinsley/ffn_membrane