Initial port from codeplex.

Bare bones and incomplete. Needs more of base functionality to work
correctly.