added scoring logic