remove redundant code, modify score function