moved some potential unused calcualations after an if,..