assuming all files have newline at the end