handle displaying of success/error message through functions