Updated add method to support inserting.