further cleanup, remove printstacktrace, fix some small unclear code, etc