Setting refs and basic device management