Fixed bugs with insert and remove in lists. Added unit tests for these.