Implementing scoring algorithm