remove debug messages; refactorings