refactor: move code to update assignment table into function