almost finished still debug flag mysteries