Add insert/delete/move close #1 and organize code