Fixed problems of counting lines, fixed some string errors
comments now close properly after reaching the end