Remove useless $id$ tags and double trailing lines