some revisions to stack and binary tree