insert function working