debugging almost finished