Cleanups to avoid using NIO resources and unnecessary code.