extended pseudo code