Clean up forEachOpenConnection() loop and use the method more