modified function e