cleanup and tostring method for theta