Quick refactoring
Oops new stuff isn't fully implemented
Stop input-blocking bug. Added more debug info. Added unfinished function.