Added Debug messages, removed unused varibles.