Fixed PublicKey class initialization; moved __main__ into tests