remove extra flags and added insert function