print success and error messages in separate functions
Refactoring: using const for terms