FIX delete print_r, and some code cleaning