implemented original scoring function in a more efficient manner, cleaned up some of the code