add rates function