Added logic element classes. Updated grid creation code. Added logic element selection code.