Code optimization to reduce size in 'modal'