Add support for API version 3

Sorry it's a bit messy with the triple-nested map, but I've tried to keep it in concordance with the existing coding style. This seems to work whenever I test it.