more functional counting of score. Still incorrect though :-(