Fixed formulation,changed some useless conversions