added feature to handle comments and newlines