merged extras.hpp from egfrd-branch