First commit.

Includes a first draft of all the functions I consider worth porting.