Fixing logic and removing dpm.