Split into functions.