Don't mix I/O in a method