Update the assignments behavior and do major cleanup of the code