clean up and improve equation model