add rates functionality + refactor