Make exit and intermediate message functions return identical variables.
Add newkey generation functionality