updated the same function with proper message