Refactoring, moved stuff to braid-util