midway through amending to work with keystore