Implement function to assign score