First working version with direct modex.