Fixed bug where evaluating logic with zero wires onscreen caused a crash. Refactored code for readability / added comments.