Updated code as per Anze's comment CORE-557