prefix names with $ and reduce newlines