Edited implementation of InsertCommand