add alot of older changes long forgoton to make it work