The longer version of this same question, split into the situations behind it and answered with two methods.