pseudocode added