finished and cleaned up userkeymgmt.py