lots of debug and changes