split some stuff off to a common class