factoring out local specific code