fixed pseudocode and determin of configuration