Major update to rate_function
bruce's files from threadless_graph