refactor key manager and config file
+ clean files