optimize score get function