The initial functionality works. There's still a number of TODOs to clean up, and some edge cases to work around, and some errors that could be handled better.