Moving some utility functions from other repos