working version without score