Fixed fluxes, some cleaning of code