Revert "moved some potential unused calcualations after an if,.."

This reverts commit 2f4ce7e6d9c7c8022498794b314cbb8c5b84e799.