a little bit of refractoring