needs refractoring