refactoring because the two formats share the code for parsing
annotation