added in CH10 ex.6 (wrap function)