Good function - I think we'll port this over to the general libs