pseudo code for lowlevel