refactor to remove newlines and make pdf for mac