seems I need to rewrite the code