misc lots of refractoring