Cleanup and comment a bit
Change to a different sort of API, implement queries