Rearranging code a bit, fundamentally the same.