Improve imp/exp function