Added keep_alive handling