Code cleanup

Added "LoopResult" data type that helps readability of the Search
code. Also added a node counter to the SearchState.