Extracted a couple of methods.