Break up many inline statements into two functions
More breaking into functions
Breaking inline code into functions, contd.