Better debugging & minor fixes