functions for getting d and e