More pseudocode and some fixing