VID-1482 using getMessages and code cleanup