Faster score computation. Added basic unit testing.