implement insert and print function