fixes as per comments from MMinella