Extracted lots of functions.