fix insert method, added tests

still need to refactor