implemented score logic