refactored eprescribe and mocked tests