Maybe this can be moved to BaseLib?