what's a general way to implement this then ?