First rough attempt at functions.