Fixing internal exposing bug and counting newlines. Removing unused variables