editted it, gives errors though in places i did not change