Better debug messages and some cleanup