Shell Implementation using a binary tree