Fixed comments, intendation and removed debug output code