add rate logic