Added isBst function