changed souce code optimization and added score