Fixed some stuff and added a debug window

Trig yet to be fixed