added psudocode to bagdt