add insert function with position parameter, not the perfect way since there is still need more condition statement, but generally works