fixes #6 and fixes the second bullet under #5

Tests pass. And I'm already using the changes in my api-lookup.

Thumbs @PreetamJinka ?