Fix type restore.
Implement convert.
Move implementation out.