Remove superfluous line breaks, place all reference links at foot of document