Class cast.

Agreed about tests and docs; but I wanted to get a review - pushed this late last night.