Insert function implemented