Improve with proper stdio