Clean up res.end code