refactored and added tests to avg rating