Moved code into class file.