simplify, externalize some stuff