Rework annotation submitting code. Removes code duplication.