Setting all references correctly