Modifications to improve ERPAL, which will be ported back to erpal