Added middle insertions and unit test