Fix some references and structure