insert function recursing correctly