Implement rate functionality and refactor xml