cleaned up some parameters and functions and added references to the papers where the equations are drawn from