Make rid the default for AD and move stuff to utils file