Removed rate_ids array. It is no more necessary. It was wrong implementation anyway. Also hugely hampered speed of grid rendering. Fixed the problem now.