refined as per Jacobs suggestions