Fixed references and some other things