Major reorganization of rate function; minor update to docs