Moved functions into a class file.