Moved password getting code out of main into library