Working. Needs more refactoring to clean up some gross API.