Fixed some minor faults and removed the debug output