affix levels function