cleaned up insert and some other methods