how does a dex work