Switched to compact format for dependent input blocks.
TODO: Test with BlocksWithSide.
Improved abstraction and comments.
Incorporated changes from main Blockly.