Added known public keys, rearranged some code