cleanup formating, added print to stderr for warnings