fixed problem with losing sgf keys
refactoring
refactoring using assoc