Correct name to all arrays. Fixed some typos in loop and missing dm. Changed r() to rate(). Added G. Now there are some more complex problems.