Start of making time delay code
fix quartic loss def