Clean up the FFS optimization code, and make it correctly create the appropriate