MID-1772 - fixed + some minor code cleanup based on Notes from Vilo.