Converted the code to use a class and nested my functions within it.