Updated to use episodes instead of epochs