Moved some stuff to a utility module