infinite loop is occuring in finish_assignment method
finish_assignment method no longer gets stuck in an infinite loop
updated demo with fixes