Better logging and fix some windows issues