:v: Added code to set mode dynamically based on ext