This reverts commit 17b8b86d68badfe27c29c7448548f9eb97dd26e9. Reverted because of lingering file descriptors (memory leak)