Cleaned up and put modal testing into class.