Fixed the removal. Added tests as well.