some pseudocode translation