need to comment and reformat, maybe change evaluation function v23