added return statements to enforce non-blocking io