Created insert function.