Implemented key diversification, still does not quite work