Added logging on public key not found, refactoring