Implement general update of annotation groups and refactor some code